/**
 * 
 */
package com.cqcis.uip.module.salary.oper.dao;

import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;

import com.cqcis.uip.base.framework.utils.JdbcUtil;
import com.cqcis.uip.module.salary.oper.SalaryConstants;
import com.cqcis.uip.module.salary.oper.domain.SalaryTCDetail;

/**
 * @author 李世军
 * 
 *         创建于 2012-3-10 下午03:44:52
 */
public class SalaryTCDetailDao extends SimpleJdbcDaoSupport {
	private static String INSERT_SQL = " insert into financecontrol_salarytcdetail(employe_id,trainingcontract_id,course_id,e1,e2,rebate,self_ratio,fee,month,remark,real_e,rebate_fee,study_type) "
			+ " values(:employe_id,:trainingcontract_id,:course_id,:e1,:e2,:rebate,:self_ratio,:fee,:month,:remark,:real_e,:rebate_fee,:study_type) ";

	private static String DELETE_SQL = " delete from financecontrol_salarytcdetail where month>=? and month<=?   ";

	/**
	 * 保存
	 * 
	 * @param salaryMain
	 */
	public void insert(SalaryTCDetail detail) {
		detail.setMonth(SalaryConstants.SALARY_GENERATE_DATE);
		JdbcUtil.update(INSERT_SQL, detail, this);
	}

	/**
	 * 删除当月数据
	 */
	public void delete() {
		JdbcUtil.update(this, DELETE_SQL, SalaryConstants.SALARY_BEGIN_DATE, SalaryConstants.SALARY_END_DATE);
	}
}
